<?php echo view('header.html');?>

<body class="layui-view-body bgwhite">
	<div class="layui-content">
		<div class="layui-row">
			<div class="layui-cards">

				<div class="layui-card-body">

					<div class="form-list-table">
						<div class="layui-form ">

							<div class="layui-row layui-col-space15">
								<!--左侧 主要内容-->
								<div class="layui-col-md12">

									<div class="layui-form-item">
										<label class="layui-form-label"><span class="text-red">*</span>名称:</label>
										<div class="layui-input-block">
											<input type="text" name="data[name]" value="<?=$data['name'] ?? ''?>" class="layui-input">
											<span class="help-block">起个名字便于识别</span>
										</div>
									</div>
									<div class="layui-form-item">
										<label class="layui-form-label"><span class="text-red">*</span>上传地址:</label>
										<div class="layui-input-block">
											<input type="text" name="data[uri]" value="<?=$data['uri'] ?? ''?>" class="layui-input">
											<span class="help-block">上传提交到后台的URI 如 admin/uploads/imgs</span>
										</div>
									</div>

									<div class="layui-form-item">
										<label class="layui-form-label">允许文件:</label>
										<div class="layui-input-block">
											<input type="text" name="data[ext]" value="<?=$data['ext'] ?? ''?>" class="layui-input">
											<span class="help-block">如:jpg,png,gif 用英文逗号隔开,不填,则全部禁止上传</span>
										</div>
									</div>

									<div class="layui-form-item">
										<label class="layui-form-label">文件数量:</label>
										<div class="layui-input-block">
											<input type="text" name="data[count]" value="<?=$data['count'] ?? ''?>" class="layui-input">
											<span class="help-block">如:2 不填 则不限制</span>
										</div>
									</div>

									<div class="layui-form-item">
										<label class="layui-form-label">单文件大小:</label>
										<div class="layui-input-block">
											<input type="text" name="data[size]" value="<?=$data['size'] ?? ''?>" class="layui-input">
											<span class="help-block">单位是 kb (过大文件注意服务器的限制)</span>
										</div>
									</div>

								</div>


							</div>

							<div class="layui-form-item">
								<label class="layui-form-label"></label>
								<div class="layui-input-block">
									<button class="layui-btn layui-btn-blue" lay-submit="" lay-filter="ams_submit">提交保存</button>
								</div>
							</div>

						</div>
					</div>

				</div>
			</div>
		</div>
	</div>
	<?php echo view('footer.html');?>
	<script type="text/javascript">
		layui.use(['form', 'jquery', 'layer', 'upload'], function () {
			var $ = layui.jquery,
				form = layui.form,
				layer = layui.layer;
			

			var url = window.location.href;

			form.on('submit(ams_submit)', function (data) {
				$.post(url, data.field, function (res) {
					if (res.code == 0) {
						layer.msg(res.msg, { icon: 1, time: 1500 }, function () {
							var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
							// parent.location.href = adminpath + '/role/index';
							parent.location.reload();
							parent.layer.close(index);
							// location.href = adminpath + 'admin/combo/index';
						});
					} else {
						layer.msg(res.msg, { icon: 5, time: 1500 });
					}
				}, 'json');
				return false;
			});

		});

	</script>
</body>

</html>
